/**
*
*	\file  peripheral.h
*	\author Manish Shakya 
*	\brief
*	\date  Tuesday,October 27,2009
*	\version 1.0
*
*
*/
#ifndef	__PERIPHERALS_H__
#define __PERIPHERALS_H__
	
	#include "lpc.h"
	#include "inttypes.h"	
	#include "app-config.h"	
	

	#if UART0_DEBUG == 1 && UART1_DEBUG == 1
			#error "BOTH UARTs cannot be set to DEBUG"
	#endif

	#include "uart0.h"
	#include "uart1.h"
	#include "fio.h"
	
	#include "adc.h"
	#include "timer32.h"
	#include "swi.h"
	#include "iap.h"
	#include "watchdog.h"
	#include "spi0.h"
	#include "spi1.h"
	#include "rtc.h"

	#include "ext.h"
	#include "i2c0.h"


	#if UART0_DEBUG == 1 || UART1_DEBUG == 1
		#include <stdio.h>
		#define TRACE(X ,reg...)    do{	\
			printf("\r\n");printf(X,##reg);\
			}while(0)
		#define trace(X ,reg...)    do{	\
			printf(X,##reg);\
			}while(0)
		#define ASSERT(expr) \
			do{\
		 if (expr) { ; } \
			  else  {\
			  	while (1){	\
						printf("\r\nAssert failed: " #expr " (file %s line %d)", __FILE__, (int) __LINE__ );\
				}\
		  }\
		  }while(0)

		  #define EP()  TRACE("%s Line %d", __FILE__, (int) __LINE__) ;
	#else	

		#define TRACE_INIT() 	do{}while(0)
		#define ASSERT(X) 		do{}while(0)
    	#define TRACE(X ,reg...) do{}while(0)			
		#define trace(X ,reg...) do{}while(0)			
		#define EP()  	do{}while(0)			
	#endif

	#define  __IRQ__
	#include "irq.h"
#endif



